package com.doyens.item.mapper;

import com.doyens.item.pojo.Brand;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BrandMapper extends Mapper<Brand> {

    @Insert("insert into tb_category_brand (category_id,brand_id) values(#{cid},#{bid})")
    void saveBrandAndCategoryId(@Param("bid") Long bid, @Param("cid") Long cid);

    @Select("select * from tb_brand inner join tb_category_brand on id=brand_id where category_id=#{cid}")
    List<Brand> selectBrandByCid(Long cid);
}
